home *** CD-ROM | disk | FTP | other *** search
/ Easy Internet / Internet Training Corporation Easy Internet Rev21 (ITC).ISO / pc / data / 1012.scp < prev    next >
Text File  |  1997-05-13  |  2KB  |  132 lines

  1. ;
  2. ; This is a script file that demonstrates how
  3. ; to establish a PPP connection with a host
  4. ; that uses a menu system.
  5. ;
  6. ; A script file must have a 'main' procedure.
  7. ; All script execution starts with this 'main'
  8. ; procedure.
  9. ;
  10.  
  11. ; File: infonex.scp
  12. ; Version: 1.0
  13.  
  14. ; Main entry point to script
  15. ;
  16. proc main
  17.  
  18.    ; Change these variables to customize for your
  19.    ; specific Internet service provider
  20.  
  21.    integer nTries = 3
  22.  
  23.    ; This is the login prompt and timeout values
  24.  
  25.    string szLogin = "username:"
  26.    integer nLoginTimeout = 3
  27.  
  28.    ; This is the password prompt and timeout values
  29.  
  30.    string szPW = "password:"
  31.    integer nPWTimeout = 3
  32.  
  33.    ; This is the prompt once your password is verified
  34.  
  35.    string szPrompt = "annex:"
  36.  
  37.    ; Send ppp to establish the protocol
  38.  
  39.    string szConnect = "ppp^M"
  40.  
  41.    ; Set this to FALSE if you don't want to get an IP
  42.    ; address
  43.  
  44.    boolean bUseSlip = FALSE
  45.  
  46.    
  47.    ; -----------------------------------------------------
  48.  
  49.  
  50.    ; Delay for 2 seconds first to make sure the
  51.    ; host doesn't get confused when we send the
  52.    ; two carriage-returns.
  53.  
  54.    delay 1
  55.    transmit "^M"
  56.  
  57.    delay 1
  58.    transmit "^M"
  59.  
  60.    delay 1
  61.    transmit "^M"
  62.  
  63.    delay 1
  64.    transmit "^M"
  65.  
  66.  
  67.    ; Attempt to login at most 'nTries' times
  68.  
  69.    while 0 < nTries do
  70.  
  71.       ; Wait for the login prompt before entering
  72.       ; the user ID, timeout after x seconds
  73.  
  74.       waitfor szLogin then DoLogin 
  75.         until nLoginTimeout
  76.  
  77. TryAgain:
  78.       transmit "^M"        ; ping
  79.       nTries = nTries - 1
  80.  
  81.    endwhile
  82.  
  83.    goto BailOut
  84.  
  85. DoLogin:
  86.    ; Enter user ID
  87.  
  88.    transmit $USERID, raw
  89.    transmit "^M"
  90.  
  91.    ; Wait for the password prompt 
  92.  
  93.    waitfor szPW until nPWTimeout
  94.    if FALSE == $SUCCESS then
  95.       goto TryAgain
  96.    endif
  97.  
  98.    ; Send the password
  99.  
  100.    transmit $PASSWORD, raw
  101.    transmit "^M"
  102.  
  103.    ; Wait for the prompt
  104.  
  105.    waitfor szPrompt
  106.  
  107.    transmit szConnect
  108.  
  109.    if bUseSlip then
  110.       ; An alternative to the following line is
  111.       ;
  112.       ;     waitfor "Your address is "
  113.       ;     set ipaddr getip
  114.       ;
  115.       ; if we don't know the order of the IP addresses.
  116.  
  117.       set ipaddr getip 2
  118.    endif
  119.    goto Done
  120.  
  121. BailOut:
  122.    ; Something isn't responding.  Halt the script
  123.    ; and let the user handle it manually.
  124.  
  125.    set screen keyboard on
  126.    halt
  127.  
  128. Done:
  129.  
  130. endproc
  131.  
  132.